package com.rgs.se.java8new.myoptional;

import java.util.Optional;

/**
 * @author Ren Gaoshuai
 * @ClassName TestMain
 * @date 2022-05-01 21:37
 **/
public class TestMain {
    public static void main(String[] args) {
        User user1 = new User("战三", "123@QQ.com");

        String s = Optional.ofNullable(user1).map(q -> q.getEmail()).orElse("456@163.com");
        System.out.println(s);
        System.out.println(user1);

    }
}
